package com.snail.auth.entity;

import com.common.entity.IdEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.List;

/**
 * 角色信息
 *
 * @author houyanfeng 2018年7月13日
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Table(name = "auth_role")
public class AuthRole extends IdEntity {

    private Long groupId;//分组ID

    @Column(length = 20)
    private String name;

    @ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.ALL})
    @JoinTable(name = "auth_role_authority", joinColumns = {@JoinColumn(name = "role_id")}, inverseJoinColumns = {@JoinColumn(name = "authority_id")})
    private List<AuthAuthority> authorities;

    /**
     * 是否使用；0-使用中；1-不使用
     */
    private Integer flag;
}
